package Homework.jdbcwork3;

import java.sql.*;

/**
 * @author shkstart
 * @creat 2022-05-13:49
 */
public class redis {
    public static void main(String[] args) {
        try {
            Class.forName("br.com.svvs.jdbc.redis.RedisDriver");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        Connection con = null;
        Statement st = null;
        ResultSet rs = null;
        try{

            con = DriverManager.getConnection("jdbc:redis://localhost");
            st = con.createStatement();
            st.execute("set s_stuno 1001");
            st.execute("get s_stuno");
            rs = st.getResultSet();
            while(rs.next()){
                System.out.println(rs.getString(0));
            }
        }catch (Exception e){
            e.printStackTrace();
        }finally {
            try {
                rs.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
            try {
                st.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
            try {
                con.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }

        }
    }
}
